import React, { Component } from 'react';
import ReactDOM from 'react-dom';

import { BrowserRouter as Router, withRouter } from 'react-router-dom'
import { Provider } from 'react-redux'
import store from './store/index'

import 'react-toastify/dist/ReactToastify.css';
import './styles.scss';
import DzRouter from './router'


class App extends Component {

    // constructor(props) {
    //     super(props)
    //     const token = getToken()
    //     if (!token) {
    //         this.props.history.push('/login')
    //     } else {
    //         this.props.history.push('/main')
    //     }
    //     //  else {
    //     //     this.props.history.push('/main')
    //     // }
    // }


    render() {
        return (
            <Provider store={store}>
                <Router>
                    <DzRouter />
                </Router>
            </Provider>
        );
    }
}


ReactDOM.render(< App />, document.getElementById('root'));
